#ifndef FILE_H
#define FILE_H

#include <QMainWindow>
#include <QWidget>
#include <QtGui/QtGui>
#include <QList>
#include "InputMethod/inputmethod.h"
#include "weiqiantools/weiqianfunctions.h"
#include <QTimer>
#include "configargs.h"

extern "C"{
	#include <stdio.h>
}

class QComboBox;
class QDirModel;
class QItemSelectionModel;
class QModelIndex;
class QLabel;
class QPushButton;
class QString;

#define READ_FILE_COUNT 0
#define READ_FILE_SIZE  1


class GetFileInfoThread : public QThread
{
	Q_OBJECT



public:
	explicit GetFileInfoThread(QObject *parent = 0);
	void SetMode(bool num);	
	void SetFilePath(const QString &);	
	void ThreadStop(void);
	quint64 getCurFileSize(void);
	quint64 getCurFileCount(void);

	QString filePath;
	 
	bool mode;
	bool aliveFlag;
	quint64 fileTotalCount;
	quint64 fileTotalSize;


	
signals:
//	void receiveSignal(const QString data);

public slots:


protected:
	void run();

private:



};

class GetUserData : public QDialog
{
	Q_OBJECT

public:
	explicit GetUserData(QWidget *parent = 0);
	~GetUserData();

	QString getdata(void);
	void setMyTitle(QString);

	
	QLabel *titleLb;

	
	QPushButton *enterBt;
	QPushButton *cancelBt;
	QLineEdit 	*dataEdit;
	InputMethod *im;


public slots:	
	void createImConnect(QString ObjName);

};






//class FilwWIndow : public QWidget
class Folder : public QDialog
//class FilwWIndow : public QDialog
{
    Q_OBJECT

public:
    explicit Folder(QWidget *parent = 0);
    ~Folder();

    
	bool copyFileToPath(QString sourceDir ,QString toDir, bool coverFileIfExist);  
	bool copyDirectoryFiles(const QString &fromDir, const QString &toDir, bool coverFileIfExist); 
	bool checkValid(void);
	void setButton(bool);
	
    QDirModel *pdirModel;
    QItemSelectionModel* selectionModel;
    QList<QString> pathList;
    int m_pos,m_flag;
    QTreeView *ptreeView;
    QSplitter *psplitter;
    QListView *plistView;

    QPushButton *removeBt;
    QPushButton *cutBt;
    QPushButton *copyBt;
    QPushButton *pasteBt;
    QPushButton *renameBt;
    QPushButton *superrmBt;
    QPushButton *mkdirBt;
    QPushButton *exitBt;
    QPushButton *refreshBt;
    QPushButton *infoBt;

	QProcess *process;
	QProcess *process1;

	QProgressDialog *pd;
	GetFileInfoThread *thread;

	quint64 fileCount;
	quint64 currCount;

	quint64 fileSize;
	quint64 currSize;
	int percent;
	
	QString srcPath;
	QString srcFileName;
	QString destPath;
	QString cmd;
	QString param;

	QTimer *timer;

	float totaltime;
	float speed;

public slots:
 
	void copyClick(void);
	void cutClick(void);
	void pasteClick(void);
	void removeClick(void);
	void renameClick(void);
	void superrmClick(void);
	void mkdirClick(void); 
    void readOut(void);
    void refreshBtClick(void);
    void processFinish(int);
    void setDialogProcess(void);
    void infoBtClick(void);
	void cancelTask();



    
};




#endif // MAINWINDOW_H
